namespace ScrumSprintMonitor.UI.Wpf.Avatars
{
	#region #using Directives

	using System;
	using System.Windows.Media;
	using System.Windows.Media.Imaging;

	using Infrastructure;

	#endregion

	public class WpfUriAvatar : IAvatar
	{
		private readonly Uri uri;

		public WpfUriAvatar(Uri uri)
		{
			this.uri = uri;
		}

		#region Implementation of IAvatar

		public object GetRepresentation(Type representationType)
		{
			if (representationType == null)
			{
				throw new ArgumentNullException("representationType");
			}

			if (representationType == typeof(ImageSource))
			{
				return new BitmapImage(this.uri);
			}

			throw new ArgumentException("Invalid representation type.", "representationType");
		}

		#endregion
	}
}